// -*- C++ -*-
#ifndef STAT_HANDLER_H
#define STAT_HANDLER_H

#include "EventHandler.h"
#include <iostream>
using std::cout;

// 统计总共处理的事件数
template <typename Event>
class StatsHandler: public EventHandler<Event> {
  
  int count_;
  
  StatsHandler() {
    count_ = 0;
  }
  
 public:
  static EventHandler<Event>* Create() {
    return new StatsHandler<Event>();
  }

  bool Handle(Event e) {
    ++count_;
    cout << "Num of process events: " << count_ << "\n";

    return true;
  }
  
  // 返回处理的事件数
  // int Count() {
  //   return _count;
  // }
};

#endif
